import serial
import MSLogger2; log = MSLogger2.get('wsgi_server')


def logInit(LogFName, LogLVL, DuplicateToStdout):
    return

def logError(Message):
    log.error(Message)

def logWarn(Message):
    log.warning(Message)

def logInfo(Message):
    log.info(Message)

def logDebug(Message):
    log.debug(Message)

def sendSMS(PortNum, PhoneNum, Message):
    modem = serial.Serial(int(PortNum))
    modem.write('ATZ\r')
    modem.write('AT+CMGF=1\r')
    modem.write('AT+CMGS="%s"\r' % (str(PhoneNum)))
    modem.write(Message)
    modem.write(chr(26))
    modem.close()
